package com.bawei.day12_broadcastrecevier.fragment;


import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bawei.day12_broadcastrecevier.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class OneFragment extends Fragment {


    public OneFragment() {

    }


    @Override
    public View onCreateView(final LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_one, container, false);
        view.findViewById(R.id.bt_send).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setAction("com.bawei.nianxing") ;
                Bundle bundle = new Bundle();
                bundle.putString("message","我是fragmentone发来的");
                intent.putExtras(bundle);
                getActivity().sendStickyBroadcast(intent);
        }
        });
        return view;
    }

}
